package service;

import java.util.List;

import dao.TeacherDAO;
import entity.Teacher;



public class TeacherService {
	private TeacherDAO teacherDAO=new TeacherDAO();

	public Teacher findById(Integer id) {
		return teacherDAO.findById(id);
	}

	public List<Teacher> findAll() {
		return teacherDAO.findAll();
	}

	public void delete(Integer id) {
		teacherDAO.delete(id);
	}
	
	public void save(Teacher teacher) {
		Integer id=teacher.getId();
		if(id==null) {
			teacherDAO.insert(teacher);
		}else {
			teacherDAO.update(teacher);
		}
	}
	public void delete(Teacher teacher) {
		teacherDAO.delete(teacher.getId());
	}
	public Teacher findByUsernameAndPassword(String username,String password) {
		return teacherDAO.findByUsernameAndPassword(username, password);
	}
}
